//package com.zoncont.web.controller.advice;
//
//
//import com.zoncont.common.core.domain.AjaxResult;
//import org.springframework.core.MethodParameter;
//import org.springframework.http.MediaType;
//import org.springframework.http.converter.HttpMessageConverter;
//import org.springframework.http.server.ServerHttpRequest;
//import org.springframework.http.server.ServerHttpResponse;
//import org.springframework.web.bind.annotation.RestControllerAdvice;
//import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
//
//@RestControllerAdvice("com.zoncont.web.controller")
//public class BaseResponseAdvice implements ResponseBodyAdvice<Object> {
//
//    @Override
//    public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
//        return true;
//    }
//
//    @Override
//    public AjaxResult beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
//        AjaxResult result;
//        if (body == null) {
//            result = new AjaxResult();
//        } else if (body instanceof AjaxResult) {
//            result = (AjaxResult) body;
//        } else {
//            result = AjaxResult.success("", body);
//        }
//        return result;
//    }
//
//}
